<html>
<head><meta charset="utf-8"><title>just-resolver · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html">just-resolver</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="218482217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218482217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218482217">(Dec 01 2020 at 21:11)</a>:</h4>
<p>Is there an easy way for me to run _just_ the resolver, but not update the index, download any <code>.crate</code> files or build anything? <code>cargo generate-lockfile</code> updates the index, <code>cargo metadata</code> downloads the <code>.crate</code> files, and <code>cargo metadata --no-deps</code> doesn't run the resolver from what I can tell...</p>



<a name="218482367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218482367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218482367">(Dec 01 2020 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="120054">@Jon Gjengset</span> I think <code>cargo update -p some-path-dependency</code> should work</p>



<a name="218486632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218486632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218486632">(Dec 01 2020 at 21:47)</a>:</h4>
<p>Ah, interesting. So I just inject a random empty path dependency and then do a precise "update" of that. I'll give that a shot, thanks</p>



<a name="218487686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218487686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218487686">(Dec 01 2020 at 21:56)</a>:</h4>
<p>Unfortunately <code>cargo update -p empty-path-dep</code> still updates the registry if there isn't a lockfile present :/</p>



<a name="218488777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218488777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218488777">(Dec 01 2020 at 22:05)</a>:</h4>
<p>oh if you want to skip the index update I think <code>--offline</code> should do it?</p>



<a name="218488783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218488783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218488783">(Dec 01 2020 at 22:05)</a>:</h4>
<p>I may be misunderstanding the goal though</p>



<a name="218488897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218488897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Pietro Albini <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218488897">(Dec 01 2020 at 22:06)</a>:</h4>
<p>isn't there <code>-Zno-update-index</code> too?</p>



<a name="218488938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218488938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218488938">(Dec 01 2020 at 22:06)</a>:</h4>
<p>Yes, but that literally just skips the git fetch.</p>



<a name="218489247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218489247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218489247">(Dec 01 2020 at 22:10)</a>:</h4>
<p>if you don't have a lock file <code>cargo generate-lockfile --offline</code> doesn't do an update or download crates</p>



<a name="218494574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218494574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218494574">(Dec 01 2020 at 23:03)</a>:</h4>
<p>Hehe, yeah, so, I'm definitely trying to do something a little weird. Essentially, I want to emulate what would happen if you ran <code>cargo build</code>, but I want to benchmark _just_ the index part of that. And unfortunately, there's no one command (it seems) that interacts with the index the same way build does. That is: only update the index if you need to, and only download index files if you need them, but _also_ don't download any <code>.crate</code> files and don't actually build anything.</p>



<a name="218494597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218494597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218494597">(Dec 01 2020 at 23:04)</a>:</h4>
<p><code>--offline</code> doesn't quite work, because I do want it to update/fetch from the index _if it needs to_</p>



<a name="218494663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218494663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218494663">(Dec 01 2020 at 23:04)</a>:</h4>
<p><code>-Zno-update-index</code> doesn't quite work again because I do want it to update the index if it needs to</p>



<a name="218494747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218494747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218494747">(Dec 01 2020 at 23:05)</a>:</h4>
<p>Maybe I just need to run different commands for each of the use-cases I want to benchmark -- I was just hoping I could use a single command as a replacement for <code>cargo build</code> to make the benchmark results more comparable.</p>



<a name="218494943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218494943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218494943">(Dec 01 2020 at 23:06)</a>:</h4>
<p><span class="user-mention" data-user-id="120054">@Jon Gjengset</span> You could do something like <code>RUSTC=/bin/false cargo build</code> to stop the moment it starts to build. ;)</p>



<a name="218494980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218494980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218494980">(Dec 01 2020 at 23:07)</a>:</h4>
<p>Huh, actually, it looks like <code>cargo build</code> actually also updates the index if there isn't a <code>Cargo.lock</code></p>



<a name="218495008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218495008">(Dec 01 2020 at 23:07)</a>:</h4>
<p>So I guess then <code>cargo update -p empty-path-dep</code> is the right approximation. Even though it seems like the index update step there should be unnecessary.</p>



<a name="218495093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218495093">(Dec 01 2020 at 23:08)</a>:</h4>
<p>I think "no <code>Cargo.lock</code>" and "have <code>Cargo.lock</code> but need to update the index to update the lockfile" are two different cases.</p>



<a name="218495146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218495146">(Dec 01 2020 at 23:08)</a>:</h4>
<p><code>cargo build</code> will update the index if there's no lockfile, or if there's a lockfile but you've changed Cargo.toml in a way that needs a new package.</p>



<a name="218495147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218495147">(Dec 01 2020 at 23:08)</a>:</h4>
<p>Hehe, the <code>RUSTC=false</code> trick is neat, though unfortunately that would still measure the downloading of the <code>.crate</code> files</p>



<a name="218495165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218495165">(Dec 01 2020 at 23:09)</a>:</h4>
<p>Ah, point.</p>



<a name="218495195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218495195">(Dec 01 2020 at 23:09)</a>:</h4>
<p>I guess I was expecting <code>cargo build</code> without a lockfile to only update the index if it needed to</p>



<a name="218496427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218496427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218496427">(Dec 01 2020 at 23:22)</a>:</h4>
<p><span class="user-mention" data-user-id="120054">@Jon Gjengset</span> In the absence of flags like <code>--offline</code>, Cargo doesn't want results to depend on what you already have locally cached.</p>



<a name="218496434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218496434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218496434">(Dec 01 2020 at 23:22)</a>:</h4>
<p>Especially if you're building a lockfile.</p>



<a name="218496486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218496486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218496486">(Dec 01 2020 at 23:23)</a>:</h4>
<p>At this point you may be better off just adding an early return in cargo?</p>



<a name="218497103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218497103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218497103">(Dec 01 2020 at 23:30)</a>:</h4>
<p>I think <code>cargo update -p empty-path-dep</code> is a good approximation for what <code>cargo build</code> would do -- just didn't expect it to behave this particular when when there wasn't a lockfile present.</p>



<a name="218531892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/just-resolver/near/218531892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/just-resolver.html#218531892">(Dec 02 2020 at 09:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120054">Jon Gjengset</span> <a href="#narrow/stream/246057-t-cargo/topic/just-resolver/near/218495147">said</a>:</p>
<blockquote>
<p>Hehe, the <code>RUSTC=false</code> trick is neat, though unfortunately that would still measure the downloading of the <code>.crate</code> files</p>
</blockquote>
<p>You could run it once, which would download the <code>.crate</code> files and then benchmark with the <code>.crate</code> files already downloaded.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>